#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int a, b;
	scanf("%d-%d", &a, &b);
	if (((a % 4 == 0 && a % 100 != 0) || a % 400 == 0) && b == 2)
		printf("29\n");
	else if (b == 2)
		printf("28\n");
	else if (b == 1 || b == 3 || b == 5 || b == 7 || b == 8 || b == 10 || b == 12)
		printf("31\n");
	else
		printf("30\n");

	return 0;
}